package insight.miescor.opp.domain;

import java.util.Comparator;

import com.primavera.integration.client.bo.BusinessObjectException;
import com.primavera.integration.client.bo.object.Location;

public class ILocation {
	public static final String[] Fields = { "Name", "Country", "CountryCode" };
	private int id;
	private String text;
	private String country;
	private String countryCode;

	public ILocation(Location location) throws BusinessObjectException {
		setId(location.getObjectId().toInteger());
		setText(location.getName());
		setCountry(location.getCountry());
		setCountryCode(location.getCountryCode());
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getCountryCode() {
		return countryCode;
	}

	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}

	public static class ILocationSort implements Comparator<ILocation> {

		@Override
		public int compare(ILocation left, ILocation right) {
			return left.text.compareTo(right.text);
		}

	}

}
